<%--<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>--%>

<%-- 
    Document   : topmenu
    Created on : 21.12.2008, 23:48:33
    Author     : Cyclone
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

        <%--<c:if test="${empty sessionScope.roles}">--%>
            <jsp:useBean id="roles" class="ru.miit.elearning.hibernate.dto.beans.Roles" scope="session" />
            <c:if test='<%=request.isUserInRole("admin")%>'>
                <jsp:setProperty name="roles" property="admin" value="true" />
            </c:if>
            <c:if test='<%=request.isUserInRole("tutor")%>'>
                <jsp:setProperty name="roles" property="tutor" value="true" />
            </c:if>
            <c:if test='<%=request.isUserInRole("student")%>'>
                <jsp:setProperty name="roles" property="student" value="true" />
            </c:if>
        <%--</c:if>--%>

<ul id="ul-topmenu">
    <c:choose>
        <%--<c:when test='<%= request.isUserInRole("admin") || request.isUserInRole("tutor") || request.isUserInRole("student")%>'>--%>
        <c:when test='${sessionScope.roles.admin || sessionScope.roles.tutor || sessionScope.roles.student}'>
            <li id="liIndex" ><a href="./">Стартовая страница</a></li>
            <c:choose>
                <%--<c:when test='<%= request.isUserInRole("admin")%>'>--%>
                <c:when test='${sessionScope.roles.admin}'>
                    <li id="liUsers"><a href="Users">Пользователи</a></li>
                    <li id="liAnnouncements"><a href="Announcements">Объявления</a></li>
                    <%--<c:if test='<%= request.isUserInRole("tutor") || request.isUserInRole("student")%>'>--%>
                    <c:if test='${sessionScope.roles.tutor || sessionScope.roles.student}'>
                        <li id="liCurriculum"><a href="Curriculum">Учебный журнал</a></li>
                    </c:if>
                    <li id="liCourses"><a href="Courses">Курсы</a></li>
                    <li id="liLabs"><a href="Labs">Практические работы</a></li>
                    <li id="liConfig"><a href="Configuration">Настройки</a></li>
                </c:when>
                <c:otherwise>
                    <c:choose>
                        <%--<c:when test='<%= request.isUserInRole("tutor")%>'>--%>
                        <c:when test='${sessionScope.roles.tutor}'>
                            <!-- тьютор -->
                            <li id="liCurriculum"><a href="Curriculum">Учебный журнал</a></li>
                            <li id="liAnnouncements"><a href="Announcements">Объявления</a></li>
                            <li id="liCourses"><a href="Courses">Курсы</a></li>
                            <li id="liLabs"><a href="Labs">Практические работы</a></li>
                            <li id="liUsers"><a href="Users">Студенты</a></li>
                        </c:when>
                        <c:otherwise>
                            <!-- студент -->
                            <li id="liCurriculum"><a href="Curriculum">Учебный журнал</a></li>
                            <li id="liAnnouncements"><a href="Announcements">Объявления</a></li>
                            <li id="liCourses"><a href="Courses">Курсы</a></li>
                            <li id="liUsers"><a href="Users">Студенты</a></li>
                        </c:otherwise>
                    </c:choose>



                </c:otherwise>
            </c:choose>

            <c:choose><c:when test='${(sessionScope.roles.admin && sessionScope.roles.tutor) || (sessionScope.roles.tutor && sessionScope.roles.student) || (sessionScope.roles.admin && sessionScope.roles.student)}'>
                    <li id="liMessages" title="Личные сообщения"><a href="Messages">ЛС</a></li>
                </c:when><c:otherwise>
                    <li id="liMessages"><a href="Messages">Личные сообщения</a></li>
                </c:otherwise>
            </c:choose>
                    <%--<li id="liMessages" title="Личные сообщения"><a href="Messages">ЛС</a></li>--%>
            <li id="liProfile"><a href="Profile">Профиль</a></li>
        </c:when>
        <c:otherwise>
            <li id="liIndex" class="current"><a href="./">Вход в систему</a></li>


        </c:otherwise>
    </c:choose>

</ul>

<script type="text/javascript">
    $(document).ready(function() {
        if(!$.browser.msie) {
            $('ul#ul-topmenu > li:first > a').corner('tl');
            $('ul#ul-topmenu > li:last > a').corner('tr');
        }
    });
</script>